#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <set>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;

int main(int argc, char *argv[])
{
    if (argc < 2)
    {
        cout << "usage: " << argv[0] << " filename" << endl;
        exit(0);
    }

    ifstream inf(argv[1]);
    vector<int> text, text1, text2;
    istream_iterator<int> is(inf);
    istream_iterator<int> eof;
    ostream_iterator<int> os1(cout, "\n");
    ostream_iterator<int> os2(cerr, " ");

    copy(is, eof, back_inserter(text));

    //sort(text.begin(), text.end(), less<string>());
    for (int ix = 0; ix < text.size(); ++ix)
    {
        if (text[ix] % 2 == 0)
            text1.push_back(text[ix]);
        else 
            text2.push_back(text[ix]);
    }

    copy(text1.begin(), text1.end(), os1);
    copy(text2.begin(), text2.end(), os2);

    return 0;
}
